package com.jk;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by scc on 2017/12/18.
 */
@SpringBootApplication
@ImportResource("classpath:spring-dubbo-customer.xml")
@ServletComponentScan
//导入spring的配置文件 相当为web.xml中的spring监听功能
public class CusMain {

    @Bean
    public Converter<String, Date> addNewConvert() {
        return new Converter<String, Date>() {
            public Date convert(String source) {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                Date date = null;
                try {
                    date = sdf.parse((String) source);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return date;
            }
        };
    }
    public static void main(String[] args) {

        SpringApplication.run(CusMain.class,args);
    }



}
